<?php
class Category extends Controller {

	function __construct()
	{
		parent::Controller();
		
		$this->load->helper('url');
		$this->load->library('frontview');
		$this->load->model(array('PhotoModel', 'CategoryModel'));

		//$this->smartylib->debugging = true;
	}

	// function index()
	// {
		// $this->smartylib->assign('category', $this->CategoryModel->getTree());
		// $this->smartylib->assign('page', $this->frontview->view());
		// $this->smartylib->display('layout.tpl');
	
	// }
	
	function index($name)
	{
		$this->smartylib->assign('page', $this->frontview->view());
		$this->smartylib->assign('cat', $this->CategoryModel->getCategory($name, true));
		$this->smartylib->assign('category', $this->CategoryModel->getSubCat($name, true));
		$this->smartylib->assign('photos', $this->PhotoModel->getPhotoByCategory($name, true));
		$this->smartylib->display('layout.tpl');
	}
}
?>